import request from '/@/utils/request';
import {versions} from '/@/api/versions'

export function getMenuList(query: object) {
    return request({
        url: `${versions}/system/menu/list`,
        method: 'get',
        params: query
    })
}

export function getUserMenus() {
    return request({
        url: `${versions}/system/user/getUserMenus`,
        method: 'get'
    })
}

export function getMenuParams() {
    return request({
        url: `${versions}/system/menu/getParams`,
        method: 'get'
    })
}

export function addMenu(data: object) {
    return request({
        url: `${versions}/system/menu/add`,
        method: 'post',
        data: data
    })
}

export function getMenuInfo(id: number) {
    return request({
        url: `${versions}/system/menu/get`,
        method: 'get',
        params: {id}
    })
}

export function updateMenu(data: object) {
    return request({
        url: `${versions}/system/menu/update`,
        method: 'put',
        data: data
    })
}


// 删除菜单
export function delMenu(menuId: number) {
    return request({
        url: `${versions}/system/menu/delete`,
        method: 'delete',
        data: {ids: [menuId]}
    })
}
